<template>
  <div class="dashboard-container">
    <div class="dashboard-text">name: {{ loginUserName }}</div>
  </div>
</template>

<script>
import {mapGetters} from 'vuex'
import {getInfo} from "@/api/auth";

export default {
  name: 'Dashboard',
  computed: {
    ...mapGetters([
      'name'
    ])
  },
  data: () => (
    {
      loginUserName: "",
    }
  ),
  methods: {
    getUserInfo() {
      getInfo().then(resp => {
        console.log("getUserInfo resp:", JSON.stringify(resp))
        this.loginUserName = resp.body.name
      })
    }
  },
  created() {
    this.getUserInfo()
  }
}
</script>

<style lang="scss" scoped>
.dashboard {
  &-container {
    margin: 30px;
  }

  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}
</style>
